using System;

namespace Code5Systems.FormMaster.Business
{

	#region Class FormFileDataInfo

	public class FormFileDataInfo
	{
		
#region Private Members
		private int _fileDataId;
		private int _formDataId = -1;
		private int _portalId;
		private int _tabId;
		private int _moduleId;
		private string _controlId;
		private string _contentType;
		private int _contentLegth;
		private string _filePath;
		private string _origFileName;
		private string _fileName;
		private bool _inDB;
		private byte[] _fileData;
		private int _createdByID;
		private DateTime _createdDate;
		private int _lastModifiedByID;
		private DateTime _lastModifiedDate;
#endregion
		
#region Constructors
		public FormFileDataInfo()
		{
		}
		
		public FormFileDataInfo(int fileDataId, int formDataId, int portalId, int tabId, int moduleId, string controlId, string contentType, int contentLegth, string filePath, string origFileName, string fileName, bool inDB, byte[] fileData, int createdByID, DateTime createdDate, int lastModifiedByID, DateTime lastModifiedDate)
		{
			this.FileDataId = fileDataId;
			this.FormDataId = formDataId;
			this.PortalId = portalId;
			this.TabId = tabId;
			this.ModuleId = moduleId;
			this.ControlId = controlId;
			this.ContentType = contentType;
			this.ContentLegth = contentLegth;
			this.FilePath = filePath;
			this.OrigFileName = origFileName;
			this.FileName = fileName;
			this.InDB = inDB;
			this.FileData = fileData;
			this.CreatedByID = createdByID;
			this.CreatedDate = createdDate;
			this.LastModifiedByID = lastModifiedByID;
			this.LastModifiedDate = lastModifiedDate;
		}
#endregion
		
#region Public Methods
		
		public string GetDownloadUrl(int portalId)
		{
			string strUrl = default(string);
			
			strUrl = "<a href=\"" + Utility.GetPortalAlias(portalId) + "DesktopModules/Code5Systems_FormMaster/Render.aspx";
			strUrl += "?FileDataId=" + FileDataId.ToString() + "\">" + OrigFileName + "</a>";
			
			return strUrl;
			
		}
		
#endregion
		
#region Public Properties
		public int FileDataId
		{
			get
			{
				return _fileDataId;
			}
			set
			{
				_fileDataId = value;
			}
		}
		
		public int FormDataId
		{
			get
			{
				return _formDataId;
			}
			set
			{
				_formDataId = value;
			}
		}
		
		public int PortalId
		{
			get
			{
				return _portalId;
			}
			set
			{
				_portalId = value;
			}
		}
		
		public int TabId
		{
			get
			{
				return _tabId;
			}
			set
			{
				_tabId = value;
			}
		}
		
		public int ModuleId
		{
			get
			{
				return _moduleId;
			}
			set
			{
				_moduleId = value;
			}
		}
		
		public string ControlId
		{
			get
			{
				return _controlId;
			}
			set
			{
				_controlId = value;
			}
		}
		
		public string ContentType
		{
			get
			{
				return _contentType;
			}
			set
			{
				_contentType = value;
			}
		}
		
		public int ContentLegth
		{
			get
			{
				return _contentLegth;
			}
			set
			{
				_contentLegth = value;
			}
		}
		
		public string FilePath
		{
			get
			{
				return _filePath;
			}
			set
			{
				_filePath = value;
			}
		}
		
		public string OrigFileName
		{
			get
			{
				return _origFileName;
			}
			set
			{
				_origFileName = value;
			}
		}
		
		public string FileName
		{
			get
			{
				return _fileName;
			}
			set
			{
				_fileName = value;
			}
		}
		
		public bool InDB
		{
			get
			{
				return _inDB;
			}
			set
			{
				_inDB = value;
			}
		}
		
		public byte[] FileData
		{
			get
			{
				return _fileData;
			}
			set
			{
				_fileData = value;
			}
		}
		
		public int CreatedByID
		{
			get
			{
				return _createdByID;
			}
			set
			{
				_createdByID = value;
			}
		}
		
		public DateTime CreatedDate
		{
			get
			{
				return _createdDate;
			}
			set
			{
				_createdDate = value;
			}
		}
		
		public int LastModifiedByID
		{
			get
			{
				return _lastModifiedByID;
			}
			set
			{
				_lastModifiedByID = value;
			}
		}
		
		public DateTime LastModifiedDate
		{
			get
			{
				return _lastModifiedDate;
			}
			set
			{
				_lastModifiedDate = value;
			}
		}
		
		public string FullFilePath
		{
			get
			{
				return this.FilePath + "/" + this.FileName;
			}
		}
		
		public string AttachFilePath
		{
			get
			{
				return this.FilePath + "/";
			}
		}
		
		
#endregion
		
	}
	
#endregion
	
}
